package com.fufan.mtsaas.modules.unsafeevent.baqsjrecordmain.controller;


import com.alibaba.fastjson.JSONObject;
import com.fufan.mtsaas.modules.common.bo.request.DataRequest;
import com.fufan.mtsaas.modules.common.bo.request.DataRequestT;
import com.fufan.mtsaas.modules.common.bo.request.ResultPack;
import com.fufan.mtsaas.modules.common.bo.response.RequestPojo;
import com.fufan.mtsaas.modules.common.bo.response.Result;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.request.XjsTechDeleteRequest;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.request.XjsTechIdRequest;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.request.XjsTechQueryRequest;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.request.XjsTechSaveRequest;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.response.XjsDeptInfoResponse;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.response.XjsTechResponse;
import com.fufan.mtsaas.modules.newtech.xjstech.bo.response.XjsThisUserInfo;
import com.fufan.mtsaas.modules.newtech.xjstech.model.XjsTech;
import com.fufan.mtsaas.modules.unsafeevent.baqsjrecordmain.bo.request.*;
import com.fufan.mtsaas.modules.unsafeevent.baqsjrecordmain.bo.response.*;
import com.fufan.mtsaas.modules.unsafeevent.baqsjrecordmain.model.BaqsjRecordMain;
import com.fufan.mtsaas.modules.unsafeevent.baqsjrecordmain.service.BaqsjRecordMainSvc;
import com.fufan.mtsaas.util.JSonUtil;
import com.fufan.mtsaas.util.ParamUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 * 不良事件主记录
 * </p>
 *
 * @author Liby
 * @since 2025-02-18
 */
@Api(tags = "不安全事件-主接口")
@RestController
@RequestMapping("/MTSaas/baqsjRecord")
@Slf4j
public class BaqsjRecordMainCtrl {
    @Autowired
    private BaqsjRecordMainSvc targetService;

    /**
     * 审批
     */
    @ApiOperation(value = "审批", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doApprove")
    public Result<T> doApprove(@RequestBody DataRequestT<UnsafeeventApproveRequest> dataRequest) {
        log.debug("doApprove parameter: {}", dataRequest);

        UnsafeeventApproveRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        return targetService.doApprove(mapData, requestPojo);
    }


    /**
     * 我的上报
     */
    @ApiOperation(value = "查询我的上报", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryMyReport")
    public Result<UnsafeeventRecordMainResponse> doQueryMyReport(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        mapData.setQueryType("report");
        mapData.setCreateBy(requestPojo.getSysId());
        return targetService.doQueryPage(mapData, requestPojo);
    }

    /**
     * 我的草稿
     */
    @ApiOperation(value = "我的草稿", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryMyDraft")
    public Result<UnsafeeventRecordMainResponse> doQueryMyDraft(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        mapData.setAuditStatus(1);
        mapData.setQueryType("draft");
        mapData.setCreateBy(requestPojo.getSysId());
        return targetService.doQueryPage(mapData, requestPojo);
    }

    /**
     * 待我审批
     */
    @ApiOperation(value = "待我审批", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryMyPendingApprove")
    public Result<UnsafeeventRecordMainResponse> doQueryMyPendingApprove(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        mapData.setQueryType("waitingApproval");
        mapData.setCreateBy(requestPojo.getSysId());
        return targetService.doQueryPage(mapData, requestPojo);
    }


    /**
     * 我已审批
     */
    @ApiOperation(value = "我已审批", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryMyApproved")
    public Result<UnsafeeventRecordMainResponse> doQueryMyApproved(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        mapData.setQueryType("alreadyApproved");
        mapData.setCreateBy(requestPojo.getSysId());
        return targetService.doQueryPage(mapData, requestPojo);
    }


    /**
     * 抄送我的
     */
    @ApiOperation(value = "抄送我的", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryCCToMe")
    public Result<UnsafeeventRecordMainResponse> doQueryCCToMe(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        mapData.setQueryType("copyCC");
        mapData.setCreateBy(requestPojo.getSysId());
        return targetService.doQueryPage(mapData, requestPojo);
    }

    /**
     * 查询
     */
    @ApiOperation(value = "查询", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryPage")
    public Result<UnsafeeventRecordMainResponse> doQuery(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        return targetService.doQueryPage(mapData, requestPojo);
    }

    /**
     * 统计
     */
    @ApiOperation(value = "统计", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doSummary")
    public Result<T> doSummary(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        return targetService.doSummary(mapData, requestPojo);
    }

    /**
     * 质控报告
     */
    @ApiOperation(value = "质控报告", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doSummaryReport")
    public Result<T> doSummaryReport(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        return targetService.doSummaryReport(mapData, requestPojo);
    }

    /**
     * 查询明细
     */
    @ApiOperation(value = "查询明细", httpMethod = "POST", produces = "application/json")
    @PostMapping(value = "/doQueryDetail")
    public Result<T> doQueryDetail(@RequestBody DataRequestT<UnsafeeventQueryRequest> dataRequest) {
        UnsafeeventQueryRequest mapData = dataRequest.getData().getParam();
        RequestPojo requestPojo = ParamUtil.doChange();
        return targetService.doQueryDetail(mapData, requestPojo);
    }

    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-噎食事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentChokingFood", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentChokingFoodResponse> doSaveAccidentChokingFood(@RequestBody @Valid DataRequestT<UnsafeeventAccidentChokingFoodSaveRequest> dataRequest) {
        log.debug("doSaveAccidentChokingFood parameter: {}", dataRequest);

        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentChokingFoodSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentChokingFoodSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentChokingFood(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-跌倒、坠床事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentFall", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentFallResponse> doSaveAccidentFall(@RequestBody @Valid DataRequestT<UnsafeeventAccidentFallSaveRequest> dataRequest) {
        log.debug("doSaveAccidentFall parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentChokingFoodSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentChokingFoodSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentChokingFood(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-自杀，自伤事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentHurt", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentHurtResponse> doSaveAccidentHurt(@RequestBody @Valid DataRequestT<UnsafeeventAccidentHurtSaveRequest> dataRequest) {
        log.debug("doSaveAccidentHurt parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentHurtSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentHurtSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentHurt(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-其他意外事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentOther", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentOtherResponse> doSaveAccidentOther(@RequestBody @Valid DataRequestT<UnsafeeventAccidentOtherSaveRequest> dataRequest) {
        log.debug("doSaveAccidentOther parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentOtherSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentOtherSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentOther(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-出走事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentOut", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentOutResponse> doSaveAccidentOut(@RequestBody @Valid DataRequestT<UnsafeeventAccidentOutSaveRequest> dataRequest) {
        log.debug("doSaveAccidentOut parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentOutSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentOutSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentOut(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-意外事件-自杀，自伤事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveAccidentSelfKill", method = RequestMethod.POST)
    public Result<UnsafeeventAccidentSelfKillResponse> doSaveAccidentSelfKill(@RequestBody @Valid DataRequestT<UnsafeeventAccidentSelfKillSaveRequest> dataRequest) {
        log.debug("doSaveAccidentSelfKill parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventAccidentSelfKillSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventAccidentSelfKillSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveAccidentSelfKill(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-诊疗相关-饮食差错事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDiagnosisDietWrong", method = RequestMethod.POST)
    public Result<UnsafeeventDiagnosisDietWrongResponse> doSaveDiagnosisDietWrong(@RequestBody @Valid DataRequestT<UnsafeeventDiagnosisDietWrongSaveRequest> dataRequest) {
        log.debug("doSaveDiagnosisDietWrong parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDiagnosisDietWrongSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDiagnosisDietWrongSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDiagnosisDietWrong(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-诊疗相关-输液反应事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDiagnosisInfusionReaction", method = RequestMethod.POST)
    public Result<UnsafeeventDiagnosisInfusionReactionResponse> doSaveDiagnosisInfusionReaction(@RequestBody @Valid DataRequestT<UnsafeeventDiagnosisInfusionReactionSaveRequest> dataRequest) {
        log.debug("doSaveDiagnosisInfusionReaction parameter: {}", dataRequest);

        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDiagnosisInfusionReactionSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDiagnosisInfusionReactionSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDiagnosisInfusionReaction(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-诊疗相关-医疗处置事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDiagnosisMedicalHandle", method = RequestMethod.POST)
    public Result<UnsafeeventDiagnosisMedicalHandleResponse> doSaveDiagnosisMedicalHandle(@RequestBody @Valid DataRequestT<UnsafeeventDiagnosisMedicalHandleSaveRequest> dataRequest) {
        log.debug("doSaveDiagnosisMedicalHandle parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDiagnosisMedicalHandleSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDiagnosisMedicalHandleSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDiagnosisMedicalHandle(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-诊疗相关-其他反应事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDiagnosisOtherReaction", method = RequestMethod.POST)
    public Result<UnsafeeventDiagnosisOtherReactionResponse> doSaveDiagnosisOtherReaction(@RequestBody @Valid DataRequestT<UnsafeeventDiagnosisOtherReactionSaveRequest> dataRequest) {
        log.debug("doSaveDiagnosisOtherReaction parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDiagnosisOtherReactionSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDiagnosisOtherReactionSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDiagnosisOtherReaction(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-诊疗相关-报告异常，标本差错事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDiagnosisSampleWrong", method = RequestMethod.POST)
    public Result<UnsafeeventDiagnosisSampleWrongResponse> doSaveDiagnosisSampleWrong(@RequestBody @Valid DataRequestT<UnsafeeventDiagnosisSampleWrongSaveRequest> dataRequest) {
        log.debug("doSaveDiagnosisSampleWrong parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDiagnosisSampleWrongSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDiagnosisSampleWrongSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDiagnosisSampleWrong(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-医患沟通相关-医患沟通 (纠纷) 事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveDoctorAndPatientNegotiation", method = RequestMethod.POST)
    public Result<UnsafeeventDoctorAndPatientNegotiationResponse> doSaveDoctorAndPatientNegotiation(@RequestBody @Valid DataRequestT<UnsafeeventDoctorAndPatientNegotiationSaveRequest> dataRequest) {
        log.debug("doSaveDoctorAndPatientNegotiation parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventDoctorAndPatientNegotiationSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventDoctorAndPatientNegotiationSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveDoctorAndPatientNegotiation(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-院感相关-院内感染事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveHospitalInfected", method = RequestMethod.POST)
    public Result<UnsafeeventHospitalInfectedResponse> doSaveHospitalInfected(@RequestBody @Valid DataRequestT<UnsafeeventHospitalInfectedSaveRequest> dataRequest) {
        log.debug("doSaveHospitalInfected parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventHospitalInfectedSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventHospitalInfectedSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveHospitalInfected(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-药物相关-药物不良反应事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveMedicalBadReaction", method = RequestMethod.POST)
    public Result<UnsafeeventMedicalBadReactionResponse> doSaveMedicalBadReaction(@RequestBody @Valid DataRequestT<UnsafeeventMedicalBadReactionSaveRequest> dataRequest) {
        log.debug("doSaveMedicalBadReaction parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventMedicalBadReactionSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventMedicalBadReactionSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveMedicalBadReaction(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-药物相关-给药错误事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveMedicalWrongDrug", method = RequestMethod.POST)
    public Result<UnsafeeventMedicalWrongDrugResponse> doSaveMedicalWrongDrug(@RequestBody @Valid DataRequestT<UnsafeeventMedicalWrongDrugSaveRequest> dataRequest) {
        log.debug("doSaveMedicalWrongDrug parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventMedicalWrongDrugSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventMedicalWrongDrugSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveMedicalWrongDrug(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-医疗器械相关-医疗器械事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveMedicalInstrument", method = RequestMethod.POST)
    public Result<UnsafeeventMedicalInstrumentResponse> doSaveMedicalInstrument(@RequestBody @Valid DataRequestT<UnsafeeventMedicalInstrumentSaveRequest> dataRequest) {
        log.debug("doSaveMedicalInstrument parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventMedicalInstrumentSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventMedicalInstrumentSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveMedicalInstrument(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-其他不良事件上报-其他事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveOtherReactionGeneral", method = RequestMethod.POST)
    public Result<UnsafeeventOtherReactionGeneralResponse> doSaveOtherReactionGeneral(@RequestBody @Valid DataRequestT<UnsafeeventOtherReactionGeneralSaveRequest> dataRequest) {
        log.debug("doSaveOtherReactionGeneral parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventOtherReactionGeneralSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventOtherReactionGeneralSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveOtherReactionGeneral(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-其他不良事件上报-公共事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveOtherReactionPublic", method = RequestMethod.POST)
    public Result<UnsafeeventOtherReactionPublicResponse> doSaveOtherReactionPublic(@RequestBody @Valid DataRequestT<UnsafeeventOtherReactionPublicSaveRequest> dataRequest) {
        log.debug("doSaveOtherReactionPublic parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventOtherReactionPublicSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventOtherReactionPublicSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveOtherReactionPublic(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-其他不良事件上报-公共治安事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveOtherReactionPublicSecurity", method = RequestMethod.POST)
    public Result<UnsafeeventOtherReactionPublicSecurityResponse> doSaveOtherReactionPublicSecurity(@RequestBody @Valid DataRequestT<UnsafeeventOtherReactionPublicSecuritySaveRequest> dataRequest) {
        log.debug("doSaveOtherReactionPublicSecurity parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventOtherReactionPublicSecuritySaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventOtherReactionPublicSecuritySaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveOtherReactionPublicSecurity(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-防保相关-职业暴露不良事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSavePreventionAndProtection", method = RequestMethod.POST)
    public Result<UnsafeeventPreventionAndProtectionResponse> doSavePreventionAndProtection(@RequestBody @Valid DataRequestT<UnsafeeventPreventionAndProtectionSaveRequest> dataRequest) {
        log.debug("doSavePreventionAndProtection parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventPreventionAndProtectionSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventPreventionAndProtectionSaveRequest.class);

        return resultPack.doResultPack(targetService.doSavePreventionAndProtection(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-手术相关-手术不良事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveSurgicalBad", method = RequestMethod.POST)
    public Result<UnsafeeventSurgicalBadResponse> doSaveSurgicalBad(@RequestBody @Valid DataRequestT<UnsafeeventSurgicalBadSaveRequest> dataRequest) {
        log.debug("doSaveSurgicalBad parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventSurgicalBadSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventSurgicalBadSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveSurgicalBad(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-手术相关-非计划手术不良事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveSurgicalNonPlaned", method = RequestMethod.POST)
    public Result<UnsafeeventSurgicalNonPlanedResponse> doSaveSurgicalNonPlaned(@RequestBody @Valid DataRequestT<UnsafeeventSurgicalNonPlanedSaveRequest> dataRequest) {
        log.debug("doSaveSurgicalNonPlaned parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventSurgicalNonPlanedSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventSurgicalNonPlanedSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveSurgicalNonPlaned(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-手术相关-操作不良事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveSurgicalOperationBad", method = RequestMethod.POST)
    public Result<UnsafeeventSurgicalOperationBadResponse> doSaveSurgicalOperationBad(@RequestBody @Valid DataRequestT<UnsafeeventSurgicalOperationBadSaveRequest> dataRequest) {
        log.debug("doSaveSurgicalOperationBad parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventSurgicalOperationBadSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventSurgicalOperationBadSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveSurgicalOperationBad(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-输血相关-输血反应事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveTransfusionBloodReaction", method = RequestMethod.POST)
    public Result<UnsafeeventTransfusionBloodReactionResponse> doSaveTransfusionBloodReaction(@RequestBody @Valid DataRequestT<UnsafeeventTransfusionBloodReactionSaveRequest> dataRequest) {
        log.debug("doSaveTransfusionBloodReaction parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventTransfusionBloodReactionSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventTransfusionBloodReactionSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveTransfusionBloodReaction(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 新增、编辑、暂存申报
     */
    @ApiOperation(value = "新增、编辑、暂存申报-输血相关-用血错误事件", httpMethod = "POST", produces = "application/json", response = Result.class)
    @RequestMapping(value = "/doSaveTransfusionWrongBlood", method = RequestMethod.POST)
    public Result<UnsafeeventTransfusionWrongBloodResponse> doSaveTransfusionWrongBlood(@RequestBody @Valid DataRequestT<UnsafeeventTransfusionWrongBloodSaveRequest> dataRequest) {
        log.debug("doSaveTransfusionWrongBlood parameter: {}", dataRequest);
        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        UnsafeeventTransfusionWrongBloodSaveRequest map = JSonUtil.toBean(JSonUtil.toJSONString(dataRequest.getData().getParam()), UnsafeeventTransfusionWrongBloodSaveRequest.class);

        return resultPack.doResultPack(targetService.doSaveTransfusionWrongBlood(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }


    /**
     * 删除数据
     */
    @ApiOperation(value = "删除数据", httpMethod = "DELETE", produces = "application/json")
    @RequestMapping(value = "/doDelete", method = RequestMethod.DELETE)
    public Result doDelete(@RequestBody @ApiIgnore DataRequest dataRequest) {
        log.debug("doDelete parameter: {}", dataRequest);

        ResultPack resultPack = new ResultPack();
        RequestPojo requestPojo = ParamUtil.doChange();
        JSONObject mapData = dataRequest.getData().getParam();
        UnsafeeventDeleteRequest map = JSonUtil.toBean(mapData.toJSONString(), UnsafeeventDeleteRequest.class);

        return resultPack.doResultPack(targetService.doDelete(map, requestPojo), requestPojo.getIntfId(), requestPojo.getAppKey());
    }

}
